/**
 * Created by yumeng on 2017/11/26.
 */
define([
  './themes/lang/' + window.YUFP_SYS_CONFIG.language + '/pages/example/package/elCascader.js'
], function (require, exports) {
  // page加载完成后调用ready方法
  exports.ready = function (hashCode, data, cite) {
    var height = yufp.custom.viewSize().height;
    var vm = yufp.custom.vue({
      el: '#el_cascader_x_demo',
      data: {
        myCascader: [],
        cascader: '',
        options: [{
          value: 'zhinan',
          label: this.$t('elCascader.zn'),
          disabled: true,
          children: [{
            value: 'shejiyuanze',
            label: this.$t('elCascader.sjyz'),
            children: [{
              value: 'yizhi',
              label: this.$t('elCascader.yz')
            }, {
              value: 'fankui',
              label: this.$t('elCascader.fk')
            }, {
              value: 'xiaolv',
              label: this.$t('elCascader.xl')
            }, {
              value: 'kekong',
              label: this.$t('elCascader.kk')
            }]
          }, {
            value: 'daohang',
            label: this.$t('elCascader.dh'),
            children: [{
              value: 'cexiangdaohang',
              label: this.$t('elCascader.cxdh')
            }, {
              value: 'dingbudaohang',
              label: this.$t('elCascader.dbdh')
            }]
          }]
        }, {
          value: 'zujian',
          label: this.$t('elCascader.zj'),
          children: [{
            value: 'basic',
            label: 'Basic',
            children: [{
              value: 'layout',
              label: this.$t('elCascader.bj')
            }, {
              value: 'color',
              label: this.$t('elCascader.sc')
            }, {
              value: 'typography',
              label: this.$t('elCascader.zt')
            }, {
              value: 'icon',
              label: this.$t('elCascader.tb')
            }, {
              value: 'button',
              label: this.$t('elCascader.an')
            }]
          }, {
            value: 'form',
            label: 'Form',
            children: [{
              value: 'radio',
              label: this.$t('elCascader.dxk')
            }, {
              value: 'checkbox',
              label: this.$t('elCascader.dxk')
            }, {
              value: 'input',
              label: this.$t('elCascader.srk')
            }, {
              value: 'input-number',
              label: this.$t('elCascader.jsq')
            }, {
              value: 'select',
              label: this.$t('elCascader.xzq')
            }, {
              value: 'cascader',
              label: this.$t('elCascader.jlxzq')
            }, {
              value: 'switch',
              label: this.$t('elCascader.kg')
            }, {
              value: 'slider',
              label: this.$t('elCascader.hk')
            }, {
              value: 'time-picker',
              label: this.$t('elCascader.sjxzq')
            }, {
              value: 'date-picker',
              label: this.$t('elCascader.rqxzq')
            }, {
              value: 'datetime-picker',
              label: this.$t('elCascader.rqsjxzq')
            }, {
              value: 'upload',
              label: this.$t('elCascader.sc')
            }, {
              value: 'rate',
              label: this.$t('elCascader.pf')
            }, {
              value: 'form',
              label: this.$t('elCascader.bd')
            }]
          }, {
            value: 'data',
            label: 'Data',
            children: [{
              value: 'table',
              label: this.$t('elCascader.bg')
            }, {
              value: 'tag',
              label: this.$t('elCascader.bq')
            }, {
              value: 'progress',
              label: this.$t('elCascader.jdt')
            }, {
              value: 'tree',
              label: this.$t('elCascader.sxkj')
            }, {
              value: 'pagination',
              label: this.$t('elCascader.fy')
            }, {
              value: 'badge',
              label: this.$t('elCascader.bj')
            }]
          }, {
            value: 'notice',
            label: 'Notice',
            children: [{
              value: 'alert',
              label: this.$t('elCascader.jg')
            }, {
              value: 'loading',
              label: this.$t('elCascader.jz')
            }, {
              value: 'message',
              label: this.$t('elCascader.xxts')
            }, {
              value: 'message-box',
              label: this.$t('elCascader.tk')
            }, {
              value: 'notification',
              label: this.$t('elCascader.tz')
            }]
          }, {
            value: 'navigation',
            label: 'Navigation',
            children: [{
              value: 'menu',
              label: this.$t('elCascader.dhcd')
            }, {
              value: 'tabs',
              label: this.$t('elCascader.bqy')
            }, {
              value: 'breadcrumb',
              label: this.$t('elCascader.mbx')
            }, {
              value: 'dropdown',
              label: this.$t('elCascader.xlcd')
            }, {
              value: 'steps',
              label: this.$t('elCascader.bzt')
            }]
          }, {
            value: 'others',
            label: 'Others',
            children: [{
              value: 'dialog',
              label: this.$t('elCascader.dhk')
            }, {
              value: 'tooltip',
              label: this.$t('elCascader.wzts')
            }, {
              value: 'popover',
              label: this.$t('elCascader.tck')
            }, {
              value: 'card',
              label: this.$t('elCascader.kp')
            }, {
              value: 'carousel',
              label: this.$t('elCascader.zmd')
            }, {
              value: 'collapse',
              label: this.$t('elCascader.zdmb')
            }]
          }]
        }, {
          value: 'ziyuan',
          label: this.$t('elCascader.zy'),
          children: [{
            value: 'axure',
            label: 'Axure Components'
          }, {
            value: 'sketch',
            label: 'Sketch Templates'
          }, {
            value: 'jiaohu',
            label: this.$t('elCascader.zjjhwd')
          }]
        }],
        height: height,
        setSelected: '',
        grid: {
          data1: [
            {name: 'show-all-levels', remark: this.$t('elCascader.srkzsfxsxzzdwzlj'), type: 'Boolean', option: '—', default: 'true'},
            {name: 'data', remark: this.$t('elCascader.xlsj'), type: 'Object', option: '—', default: '—'},
            {name: 'disabled', remark: this.$t('elCascader.sfjy'), type: 'Boolean', option: '—', default: 'true'},
            {name: 'placeholder', remark: this.$t('elCascader.zwf'), type: 'String', option: '—', default: '—'},
            {name: 'filterable', remark: this.$t('elCascader.sfkss'), type: 'Boolean', option: '—', default: 'true'}
          ],
          data2: [
            {name: 'getSelectdText', remark: this.$t('elCascader.hqxzdz'), param: '—'},
            {name: 'getSelectdValue', remark: this.$t('elCascader.hqxzdz'), param: '—'},
            {name: 'setSelectdByValue', remark: this.$t('elCascader.tgszxzdz'), param: this.$t('elCascader.szyszdsz')}
          ],
          data3: [
            {name: 'change', remark: this.$t('elCascader.sjdy'), param: this.$t('elCascader.xzdz')}
          ]
        }
      },
      methods: {
        handleChange: function (val) {
          console.log(this.$t('elCascader.sj') + val);// ???
        },
        getSelectdText: function () {
          this.$alert(this.$refs.myCascader.getSelectdText());
        },
        getSelectdValue: function () {
          this.$alert(this.$refs.myCascader.getSelectdValue());
        },
        resetSelect: function () {
          this.$refs.myCascader.clear();
        },
        setSelectdByValue: function () {
          var data = [ 'zujian', 'form', 'checkbox' ];
          this.$alert(this.$refs.myCascader.setSelectdByValue(data));
        }
      }
    });

    window.vm1 = vm;
  };

  // 消息处理
  exports.onmessage = function (type, message) {

  };

  // page销毁时触发destroy方法
  exports.destroy = function (id, cite) {

  };
});
